package ca.on.eho.qa.pages;

import org.openqa.selenium.By;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import ca.on.eho.qa.applogic1.DriverBasedHelper;
import ca.on.eho.qa.util.Constants;


public class GooglePage extends Page {
	
	public GooglePage(PageManager pages) {
		super(pages);

	}

	private static WebElement element = null;
	private static WebDriverWait wait = null;

	public static By by_searchField = By.id("gbqfq");
		

	@FindBy(id = "hplogo")
	private WebElement googleLogo;
	
	@FindBy(id = "gbqfq")
	private WebElement searchField;
	
	@FindBy(linkText = "Software-Testing.Ru")
	private WebElement softwareTestingRuLink;
	
	@FindBy(linkText = "Home")
	private WebElement homeLink;

	
	public GooglePage setSearchField() {
		searchField.clear();	
		searchField.sendKeys("software-testing.ru");	
		return this;		
	}
	

	public GooglePage ensurePageLoaded() {
		super.ensurePageLoaded();
		wait.until(ExpectedConditions.presenceOfElementLocated(by_searchField));
		return this;		
	}
	
}

